Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2Platformconf = require("Platformconf");
var $2MiniBase = require("MiniBase");
var $2ServerConfig = require("ServerConfig");
var $2OPPO_VideoMgr = require("OPPO_VideoMgr");
var $2VIVO_BannerMgr = require("VIVO_BannerMgr");
var $2VIVO_NativeAdMgr = require("VIVO_NativeAdMgr");
var $2VIVO_CustomAdMgr = require("VIVO_CustomAdMgr");
var $2VIVO_CreateBoxPortalAd = require("VIVO_CreateBoxPortalAd");
exports.default = /* */function (_i$default3) {
  function _class25() {
    var _this147;
    babel_classCallCheck(this, _class25);
    _this147 = _callSuper(this, _class25);
    _this147.key_maxDistance = "maxDistance";
    _this147.key_countDistance = "countDistance";
    _this147.adarr = [];
    _this147.nativeTime = 0;
    _this147.getSystemInfo = function () {};
    console.log("VIVO小游戏");
    _this147.active = !!window.qg;
    return _this147;
  }
  babel_inherits(_class25, _i$default3);
  return babel_createClass(_class25, [{
    key: "init",
    value: function init(e) {
      if (window.qg && window.qg.eqapi) {
        var _e82 = $2Platformconf.default.eqconfig();
        console.log("到了1");
        window.qg.eqapi.init(_e82);
        console.log("到了2");
      }
      this.eqInit();
    }
  }, {
    key: "eqInit",
    value: function eqInit() {
      window.qg.eqRegisterHandler(function (e) {
        console.log("++++++++++++++", e);
        $2ServerConfig.default.getInstance().init(e);
      });
    }
  }, {
    key: "eqIsAuthoried",
    value: function eqIsAuthoried() {
      return window.qg.eqIsAuthoried();
    }
  }, {
    key: "login",
    value: function login(e) {}
  }, {
    key: "loadSubpackage",
    value: function loadSubpackage(e, t) {
      console.log("loadSubpackage start");
      window.qg.loadSubpackage({
        name: e,
        success(e) {
          console.log("分包加载成功：", JSON.stringify(e));
          t.success && t.success();
        },
        fail(e) {
          console.log("分包加载失败：", JSON.stringify(e));
          t.success && t.success();
        }
      }).onProgressUpdate(function (e) {
        t.onProgressUpdate && t.onProgressUpdate(e);
      });
    }
  }, {
    key: "play_AD",
    value: function play_AD(e, t) {
      var n = $2Platformconf.default.Instance.getconfig().VIVOGame.video[t];
      n || (n = $2Platformconf.default.Instance.getconfig().VIVOGame.video[0]);
      console.log("videoID:", n);
      $2OPPO_VideoMgr.default.Instance.playvideo(n, e);
    }
  }, {
    key: "share",
    value: function share(e, t) {}
  }, {
    key: "appClick",
    value: function appClick(e, t) {
      var n = window.qg;
      n.navigateToMiniGame({
        pkgName: t.pkgName,
        success() {
          e(true);
        },
        fail(e) {
          console.log(JSON.stringify(e));
        }
      });
      n.eqTouch(t);
    }
  }, {
    key: "showLoading",
    value: function showLoading(e) {
      window.qg.showLoading({
        title: e,
        success(e) {
          console.log("".concat(e));
        },
        fail() {
          console.log("showLoading调用失败");
        }
      });
    }
  }, {
    key: "hideLoading",
    value: function hideLoading() {
      window.qg.hideLoading();
    }
  }, {
    key: "sendEvent",
    value: function sendEvent(e, t) {
      window.qg.eqSendEvent(e, t);
    }
  }, {
    key: "vibrate",
    value: function vibrate() {
      var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
      if (e) {
        window.qg.vibrateShort();
      } else {
        window.qg.vibrateLong();
      }
    }
  }, {
    key: "createImage",
    value: function createImage(e, t) {
      var n = window.qg.createImage();
      n.onload = function () {
        t(n);
      };
      n.src = e;
    }
  }, {
    key: "getTargetId",
    value: function getTargetId() {}
  }, {
    key: "onPostMessage",
    value: function onPostMessage(e) {
      console.log("onPostMessage");
      window.qg.getOpenDataContext().postMessage(e);
    }
  }, {
    key: "loginCallBack",
    value: function loginCallBack() {
      this.getTargetId();
    }
  }, {
    key: "createIcon",
    value: function createIcon() {
      window.qg.hasShortcutInstalled({
        success(e) {
          0 == e && window.qg.installShortcut({
            success() {},
            fail() {},
            complete() {}
          });
        },
        fail() {},
        complete() {}
      });
    }
  }, {
    key: "addShortcut",
    value: function addShortcut(e) {
      window.qg.installShortcut({
        success() {
          e(true);
        },
        fail() {
          e(false);
        }
      });
    }
  }, {
    key: "checkShortcut",
    value: function checkShortcut(e) {
      window.qg.hasShortcutInstalled({
        success(t) {
          e(t);
        },
        fail() {
          e(false);
        }
      });
    }
  }, {
    key: "showCustomAd",
    value: function showCustomAd(e, t) {
      var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 60;
      console.log("showCustomAd id:", e);
      var i = "";
      i = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[0];
      $2VIVO_CustomAdMgr.default.Instance.Show(i, t, n);
    }
  }, {
    key: "hideCustomAd",
    value: function hideCustomAd(e) {
      console.log("hideCustomAd id:", e);
      var t = "";
      t = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[0];
      $2VIVO_CustomAdMgr.default.Instance.Hide(t);
    }
  }, {
    key: "destroyCustomAd",
    value: function destroyCustomAd(e) {
      var t = "";
      console.log("destroyCustomAd id:", e);
      t = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[0];
      $2VIVO_CustomAdMgr.default.Instance.Destroy(t);
    }
  }, {
    key: "showNativeAD",
    value: function showNativeAD(e, t) {
      var n;
      console.log("NativeId:", e);
      n = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[0];
      $2VIVO_NativeAdMgr.default.Instance.addNode(n, t);
      t.getComponent("ComNativeView").nativeId = e;
      if (1 != this.adarr[e]) {
        if (false === $2VIVO_NativeAdMgr.default.Instance.nativeIsShow(n)) {
          console.log("使用预加载的原生广告");
          t.getComponent("ComNativeView").init($2VIVO_NativeAdMgr.default.Instance.getMsg(n));
        } else {
          $2VIVO_NativeAdMgr.default.Instance.Destroy(n);
          $2VIVO_NativeAdMgr.default.Instance.Create(n, t);
          this.adarr[e] = 1;
        }
      } else {
        console.log("显示次数过于频繁", $2VIVO_NativeAdMgr.default.Instance.getMsg(n));
        t.getComponent("ComNativeView").init($2VIVO_NativeAdMgr.default.Instance.getMsg(n));
      }
    }
  }, {
    key: "reportAdShow",
    value: function reportAdShow(e) {
      var t;
      t = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[0];
      console.log("reportAdShow    NativeId:", e, "       natid:", t);
      $2VIVO_NativeAdMgr.default.Instance.reportAdShow(t) && this.nativeTime++;
    }
  }, {
    key: "destroyNativeAD",
    value: function destroyNativeAD() {
      $2VIVO_NativeAdMgr.default.Instance.Destroy();
    }
  }, {
    key: "clickNativeAD",
    value: function clickNativeAD(e) {
      var t;
      t = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.Custom[0];
      $2VIVO_NativeAdMgr.default.Instance.ClickAD(t);
    }
  }, {
    key: "showGamePortalAd",
    value: function showGamePortalAd(e) {
      var t = 0;
      t = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.GamePortalId[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.GamePortalId[0];
      $2VIVO_CreateBoxPortalAd.default.Instance.CreateAndShow(t);
    }
  }, {
    key: "hideGamePortalAd",
    value: function hideGamePortalAd(e) {
      console.log("hideGamePortalAd");
      var t = 0;
      t = e ? $2Platformconf.default.Instance.getconfig().VIVOGame.GamePortalId[e] : $2Platformconf.default.Instance.getconfig().VIVOGame.GamePortalId[0];
      $2VIVO_CreateBoxPortalAd.default.Instance.hide(t);
    }
  }, {
    key: "bannerDestroy",
    value: function bannerDestroy(e) {
      $2VIVO_BannerMgr.default.Instance.Destroy(this.getbannerid(e));
    }
  }, {
    key: "bannerCreate",
    value: function bannerCreate(e, t) {
      $2VIVO_BannerMgr.default.Instance.Create(this.getbannerid(e), t);
    }
  }, {
    key: "bannerrefreshAD",
    value: function bannerrefreshAD(e, t) {
      $2VIVO_BannerMgr.default.Instance.refreshAD(this.getbannerid(e), t);
    }
  }, {
    key: "bannerShow",
    value: function bannerShow(e, t) {
      this.nativeTime++;
      $2VIVO_BannerMgr.default.Instance.Show(this.getbannerid(e), t);
    }
  }, {
    key: "bannerHide",
    value: function bannerHide(e) {
      $2VIVO_BannerMgr.default.Instance.Hide(this.getbannerid(e));
    }
  }, {
    key: "bannertempHide",
    value: function bannertempHide() {
      $2VIVO_BannerMgr.default.Instance.tempHide();
    }
  }, {
    key: "bannertempShow",
    value: function bannertempShow() {
      $2VIVO_BannerMgr.default.Instance.tempShow();
    }
  }, {
    key: "getbannerid",
    value: function getbannerid(e) {
      if (e) {
        return $2Platformconf.default.Instance.getconfig().VIVOGame.banner[e];
      } else {
        return $2Platformconf.default.Instance.getconfig().VIVOGame.banner[0];
      }
    }
  }, {
    key: "interstitialShow",
    value: function interstitialShow(e) {}
  }]);
}($2MiniBase.default);